package com.easy.common.exception;

/**
 * @Author: CoolPro
 * @Description: 响应状态
 * @Time: 2024-03-21 18:43
 **/
public enum ExceptionEnum {
    OK(200,"请求成功"),
    ERROR(500,"请求的数据不存在"),
    NOT_FOUND(500,"未查询到任何数据"),
    THE_SYSTEM_IS_MAINTAINED_ABNORMALLY(501,"系统正在维护，请稍后再试"),
    NETWORK_ERROR(502,"网络不行，多试几次"),
    BAD_REQUEST(400,"请求参数错误"),
    UNAUTHORIZED(401,"请求未授权"),
    FORBIDDEN(403,"请求被拒绝"),
    INTERNAL_SERVER_ERROR(500,"添加失败,已存在该数据"),
    NOT_IMPLEMENTED(501,"服务器不支持该请求需要实现的函数"),
    SERVICE_UNAVAILABLE(503,"服务器当前无法处理请求"),
    NOT_FIND_USER(10001,"用户不存在"),
    PASSWORD_NOT_EXISTS(10002,"密码错误"),
    USER_ALREADY_EXISTS(10003,"用户已存在"),
    PARAM_NOT_FOUND(20001,"参数异常：缺少必要的参数"),
    JWT_FAIL(30001,"jwt failed"),
    JWT_OUT_TIME(30002,"jwt out of time"),
    ;
    //状态码
    private Integer code;
    //错误信息
    private String message;
    //构造器
    ExceptionEnum(Integer code, String message){
        this.code=code;
        this.message=message;
    }

    //只需要添加get方法就行
    public Integer getCode() {
        return code;
    }
    public String getMessage() {
        return message;
    }

    @Override
    public String toString() {
        return code+":"+message;
    }
}
